"""导入请求库，对请求路径发送get请求，得到响应对象，如果响应状态码为200则将响应对象的content写入到目标位置"""

import requests

req_url = 'http://n.sinaimg.cn/news/crawl/117/w550h367/20220417/a3a9-08b2ca6dffe4210149dda424adf0734f.jpg'

save_path = './my_image.jpg'

reponse = requests.get(req_url)
if reponse.status_code == 200:
    with open(save_path, 'wb') as f:
        f.write(reponse.content)
        print('下载成功')
